import React, { Component } from 'react';
// import { Button } from 'antd-mobile';
require('./Radio.scss');
class Login extends Component {
  constructor() {
    super()
    this.state = {
      value: 0
    }
  }
  componentDidMount() {
    this.setState({
      value: this.props.value || 0
    })
  }
  getRadio() {
    if (this.state.value === 0) {
      return(
        <div className="radio-css-circle" onClick={() => {
          this.setState({
            value: 1
          });
          this.props.onChange(1)
        }}></div>
      )
    } else {
      return (
          <img src={require('../../images/dagou.png')} alt="" onClick={() => {
            this.setState({
              value: 0
            });
            this.props.onChange(0)
          }}/>
      );
    }
  }
  render() {
    return (
      <div className="radio-css">
        {this.getRadio.call(this)}
      </div>
    );
  }
}

export default Login;
